package com.tao.china.taobaoapi.request;

import java.io.IOException;
import java.util.List;

import com.tao.china.taobaoapi.TaobaoApiInstance;
import com.taobao.api.ApiException;
import com.taobao.api.domain.ItemProp;
import com.taobao.api.domain.PropValue;
import com.taobao.api.request.ItempropsGetRequest;
import com.taobao.api.response.ItempropsGetResponse;

public class Props {
	
	static Props props = new Props();
	
	public static Props getProps()
	{
		return props;
	}
	 
	 public static void main(String args[]) throws ApiException, IOException, InterruptedException
		{
	     List<ItemProp> props = Props.getCatProps((long) 110203);
	     for(ItemProp prop : props){
	         System.out.println("pid:"+prop.getPid());
	         System.out.println("pros:"+prop.getName());
	         List<PropValue> pValues = prop.getPropValues();
	         for(PropValue pv : pValues){
	             System.out.println("vid:"+pv.getVid());
	             System.out.println("vname:"+pv.getName());
	         }
	     }
		}
	 
	 
	 
	 /*�õ�props��Ϣ*/
	 public static List<ItemProp> getCatProps(Long cid)throws ApiException
		{
		 ItempropsGetRequest req=new ItempropsGetRequest();
		 req.setFields("pid,name,must,multi,prop_values");
		 req.setCid(cid);
//		 req.setPid(20000L);
		 ItempropsGetResponse response = TaobaoApiInstance.getInstance().getClient().execute(req);
         return response.getItemProps();
		}
}
